package com.my.servlets;
import javax.ejb.Init;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class WelcomeServlet extends HttpServlet  {
    @Override
    public void init() throws ServletException {
        String value = super.getInitParameter("WelcomeServletParamName");
        System.out.println("当前Servlet的参数：" + value);
        ServletContext context = super.getServletContext();
        String globalValue = context.getInitParameter("globalParamName");
        System.out.println("全局Servlet的参数：" + globalValue);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("doGet()");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("doPost()");
    }
}
